package cn.vivi.seckill.vo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class RespBean {
    private int code;
    private String message;
    private Object obj;

    public static RespBean success() {
        return new RespBean(RespBeanEnum.SUCCESS.getCode(), RespBeanEnum.SUCCESS.getMessage(), null);
    }

    public static RespBean success(Object obj) {
        RespBean success = RespBean.success();
        success.setObj(obj);
        return success;
    }

    public static RespBean error(RespBeanEnum beanEnum) {
        return new RespBean(beanEnum.getCode(), beanEnum.getMessage(), null);
    }

    public static RespBean error(RespBeanEnum beanEnum, Object obj) {
        RespBean error = error(beanEnum);
        error.setObj(obj);
        return error;
    }

}
